package com.maxd.service.helpTask;

import com.maxd.model.HelpBrowsingHistory;
import com.maxd.respository.helpTask.HelpBrowsingHistoryJpaRepository;
import com.maxd.respository.helpTask.HelpBrowsingHistoryRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Map;

/**
 * 浏览记录
 */
@Service
public class HelpBrowsingHistoryServiceImpl implements HelpBrowsingHistoryService {

    /** 浏览记录 */
    @Autowired
    private HelpBrowsingHistoryJpaRepository helpBrowsingHistoryJpaRepository;
    /** 浏览记录 */
    @Autowired
    private HelpBrowsingHistoryRepository helpBrowsingHistoryRepository;


    @Override
    public HelpBrowsingHistory save(HelpBrowsingHistory helpBrowsingHistory) {
        return helpBrowsingHistoryJpaRepository.save(helpBrowsingHistory);
    }

    @Override
    public Page<Map<String,Object>> selectHelpBrowsingHistoryList(Long userId, Pageable pageable) {
        return helpBrowsingHistoryRepository.selectHelpBrowsingHistoryList(userId,pageable);
    }

    @Override
    public Long selectHelpBrowsingHistoryByUserId(Long userId, Long helpTaskId) {
        return helpBrowsingHistoryRepository.selectHelpBrowsingHistoryByUserId(userId,helpTaskId);
    }

    @Override
    public int updateCreateTimeByUserId(Long helpBrowsingId, Date createTime) {
        return helpBrowsingHistoryRepository.updateCreateTimeByUserId(helpBrowsingId,createTime);
    }
}
